//
//  Insurance.h
//  PhotoAnnotate
//
//  Created by Bassem El-Tamimi on 23.01.11.
//  Copyright 2011 ePapyrus GmbH. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "MBProgressHUD.h"

@class InsuredDevice;

@interface Insurance : NSObject <UIAlertViewDelegate, MBProgressHUDDelegate> {
	BOOL conditionsAccepted;
	BOOL uninsurable;
	BOOL insured;
	NSDate *purchaseDate;
	NSDate *birthDate;
	NSNumber *notOlderThanInMonths;
	NSString *imageURL;
	NSMutableDictionary *address;
	NSMutableDictionary *bankConnection;
	BOOL robbery;
	NSNumber *monthlyRate;
	NSNumber *monthlyRateIncRobbery;
	NSMutableDictionary *importantInformation;
	NSNumber *paymentPeriod;
	
	NSMutableDictionary *propertyListData;
	
	NSDictionary *insurancePricelist;
	
	InsuredDevice *insuredDevice;
	
	NSURLConnection *connection;
	
	MBProgressHUD *HUD;
	long long expectedLength;
	long long currentLength;
    
    NSString *_agentNumber;
    NSString *_username;
    NSString *_password;
}

@property (nonatomic, assign) BOOL conditionsAccepted;
@property (nonatomic, assign) BOOL uninsurable;

@property (nonatomic, assign) BOOL insured;
@property (nonatomic, retain) NSDate *purchaseDate;
@property (nonatomic, retain) NSDate *birthDate;
@property (nonatomic, retain) NSNumber *notOlderThanInMonths;
@property (nonatomic, retain) NSString *imageURL;
@property (nonatomic, retain) NSMutableDictionary *address;
@property (nonatomic, retain) NSMutableDictionary *bankConnection;
@property (nonatomic, assign) BOOL robbery;
@property (nonatomic, retain) NSNumber *monthlyRate;
@property (nonatomic, retain) NSNumber *monthlyRateIncRobbery;
@property (nonatomic, retain) NSMutableDictionary *importantInformation;
@property (nonatomic, retain) NSNumber *paymentPeriod;

@property (nonatomic, retain) NSMutableDictionary *propertyListData;
@property (nonatomic, retain) InsuredDevice *insuredDevice;

@property (nonatomic, retain) NSDictionary *insurancePricelist;

@property (nonatomic, retain) NSURLConnection *connection;

@property (nonatomic, retain) NSString *_agentNumber;
@property (nonatomic, retain) NSString *_username;
@property (nonatomic, retain) NSString *_password;

- (BOOL)InsuranceDataExists;

- (void)updateProperties;
- (void)updatePropertyListData;

- (NSString *)deviceString;
- (NSString *)addressString;
- (NSString *)birthDateString;
- (NSString *)bankConnectionString;
- (NSString *)monthlyRateString;
- (NSString *)importantInformationString;

- (void)toggleRobbery;

- (void)conditionsHaveBeenAccepted;
- (void)conditionsHaveBeenRejected;

- (BOOL)saveChanges;

- (BOOL)noDataMissing;

- (BOOL)internetReachable;

- (NSString *)xmlDataString;

- (void)sendInsuranceDataWithinView:(UIView *)view;

- (NSString *)urlencode:(NSString *) url;

- (id) initWithAgentNumber:(NSString* )agentNumber andUsername:(NSString *)myUsername andPassword:(NSString *)myPassword;

@end
